﻿using System;
using System.Text;

namespace DictationTool.Common
{
    static class SplitWord
    {
        public static string[] SplictTo(this string str)
        {
            string replace = str.Replace("\r\n", "\n");
            StringBuilder stringBuilder = new StringBuilder(replace.Length * 3 / 2);
            foreach (var item in replace)
            {
                if (Char.IsPunctuation(item) || Char.IsWhiteSpace(item))
                {
                    stringBuilder.AppendFormat("|{0}|", item);
                }
                else
                {
                    stringBuilder.Append(item);
                }
            }

            return stringBuilder.ToString().Split('|');
        } 
    }
}
